/***********************************************************
 * Product Name: ExcelQuicker
 * Copyright (c)2005, Eunge
 * Author: Eunge
 * Web Site: www.eudev.net
 * Mail/MSN: eudev.net@yeah.net
 * ********************************************************/
using System;
using System.Collections;

namespace ExcelQuicker.Framework
{
	/// <summary>
	/// Style of column. We can set the style on specialized column
	/// </summary>
	public class EQColumnStyle: EQRangeBase  	
	{
	
		private EQDualCollection mColumnsCollection = new EQDualCollection();

		/// <summary>
		/// Remove all style
		/// </summary>
		public void RemoveColumnStyle()
		{
			this.mColumnsCollection.RemoveAll(); 
		}

		/// <summary>
		/// Set style on specialized column. We can set diferent style object on same column, etc, EQBorderStyle, EQRangeStyle
		/// </summary>
		/// <param name="columnIndex">Column index of excel document. Based on 1</param>
		/// <param name="objEQStyleBase">Style class object</param>
		public void SetColumnStyle(int columnIndex, EQStyleBase objEQStyleBase)
		{
			EQKit.CheckPosition(columnIndex);
			this.mColumnsCollection.Add(columnIndex, objEQStyleBase);
		}

		/// <summary>
		/// Output this object to excel document
		/// </summary>
		/// <param name="objWorksheet"></param>
		protected internal override void Output(Excel.Worksheet objWorksheet)
		{
			IEnumerator objIEnumerator = this.mColumnsCollection.GetEnumerator();	//Go through all the column style object
			while(objIEnumerator.MoveNext())
			{
				int index = (objIEnumerator.Current as EQDualValue).Key;
				EQStyleBase objEQStyleBase = (EQStyleBase)(objIEnumerator.Current as EQDualValue).Value;
				Excel.Range objRange = (Excel.Range)objWorksheet.Columns[index, this.Missing];
				objEQStyleBase.Output(objRange);
			}
		}

	}
}
